package com.example.aspectjlibrary;

import android.util.Log;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

/**
 * Description:    类作用描述
 * Author:         WuShengqi
 * CreateDate:     2022-09-01
 * Version:        1.0
 */

@Aspect
public class AspectJDemo {

    //声明切点为：View的点击事件，该方法的名字随便取，但是要和下面@Around()中的value保持一致
    @Pointcut("execution(void android.view.View.OnClickListener.onClick(..))")
    public void viewClickPointCut(){}

    @After("viewClickPointCut()")
    public Object dealViewClickPointCut(ProceedingJoinPoint joinPoint) throws Throwable {
        //做点击间隔判断

        Log.e("aspect>>>", "before view clicked");
        Object result = joinPoint.proceed();
        Log.e("aspect>>>", "after view clicked");
        return result;
    }
}
